package com.mall.controller;


import com.mall.entity.Product;
import com.mall.entity.Type;
import com.mall.httpResult.HttpResult;
import com.mall.httpResult.ResultCodeEnum;
import com.mall.service.TypeService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author fire
 * @since 2020-04-16
 */
@RestController
@RequestMapping("/type")
public class TypeController {

    @Autowired
    private TypeService typeService;

    @GetMapping("/listAllType")
    @ApiOperation("获取所有的商品类型")
    public HttpResult listAllType() {

        List<Type> list = typeService.listAllType();
        if (list != null) {
            return HttpResult.success(list);
        }
        return HttpResult.failure(ResultCodeEnum.NOT_FOUND, "没有商品类型");
    }
}

